Continuation Passing for C A space-efficient implementation of concurrency
نویسنده
چکیده
Threads are a convenient abstraction for programming concurrent systems. They are however expensive, which leads many programmers to use coarse-grained concurrency where a fine-grained structure would be preferable, or use more cumbersome implementation techniques. Cooperative threads can be easily implemented in a language that provides first-class continuations. Unfortunately, CPS conversion, the standard technique for adding continuations to a language, is not natural for typical imperative languages. This paper defines a notion of CPS conversion for the C programming language. Continuation Passing C (CPC) is a concurrent extension of C with very cheap threads. It is implemented as a series of source-tosource transformations, including CPS conversion, that convert a threaded program in direct style into a purely sequential C program. In this paper, we describe CPC and the transformations that are used in its implementation.
منابع مشابه
Continuation-Passing C, compiling threads to events through continuations
In this paper, we introduce Continuation Passing C (CPC), a programming language for concurrent systems in which native and cooperative threads are unified and presented to the programmer as a single abstraction. The CPC compiler uses a compilation technique, based on the CPS transform, that yields efficient code and an extremely lightweight representation for contexts. We provide a proof of th...
متن کاملCPC Compiling threads to events efficiently
We present Continuation Passing C (CPC), a programming language designed for writing concurrent systems. It features very lightweight threads, both cooperatively or preemptively scheduled, which are compiled to highly-efficient event-loop code. Its compilation passes have been proven correct. CPC has been used to write Hekate, a BitTorrent seeder able to sustain thousands of simultaneously conn...
متن کاملCompiling threads to events through continuations
In this paper, we introduce Continuation Passing C (CPC), a programming language for concurrent systems in which native and cooperative threads are unified and presented to the programmer as a single abstraction. The CPC compiler uses a compilation technique, based on the CPS transform, that yields efficient code and an extremely lightweight representation for contexts. We provide a proof of th...
متن کاملCost Model: Work, Span and Parallelism
In this class, we will overview various parallel programming technology developed. One of the technology we will examine closely is Cilk, a C/C++ based concurrency platform. Before we overview the development and implementation of Cilk, we shall first overview a brief history of Cilk technology to account for where the major concepts originate. Cilk technology has developed and evolved over mor...
متن کاملA Survey of Concurrency Control Algorithms in the Operating Systems
Concurrency control is one of the important problems in operation systems. Various studies have been reported to present different algorithms to address this problem, although a few attempts have been made to represent an overall view of the characteristics of these algorithms and comparison of their capabilities to each other. This paper presents a survey of the current methods for controlling...
متن کامل